<template>
  <div class="wx-config">
    <el-form
      ref="wxForm"
      :model="wxForm"
      :rules="formRules"
    >
      <el-form-item
        label="跳转小程序AppId"
        prop="appId"
      >
        <el-input
          ref="appId"
          v-model="wxForm.appId"
          @change="handleChangeValue"
        ></el-input>
      </el-form-item>
      <el-form-item
        label="跳转小程序页面地址"
        prop="pageUrl"
      >
        <el-input
          ref="pageUrl"
          v-model="wxForm.pageUrl"
          @change="handleChangeValue"
        ></el-input>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
export default {
  components: {},
  props: {
    wxInfo: null,
  },
  data() {
    return {
      wxForm: {
        appId: '',
        pageUrl: '',
      },
      formRules: {
        // appId: [{ required: true , message:'请输入appId', trigger:"blur" }],
        // pageUrl: [{ required: true , message:'请输入小程序页面地址', trigger:"blur" }]
      },
    };
  },
  computed: {},
  watch: {},
  created() {
    this.wxForm = this.wxInfo;
  },
  mounted() {},
  methods: {
    handleChangeValue() {
      const data = { ...this.wxForm, ___type: 'wxConfig' };
      this.$emit('selected', [data]);
    },
  },
};
</script>
<style lang="scss" scoped></style>
